import request from '@/utils/request';
import { rsaEncrypt } from '@/utils/commonUtil3';

// 系统管理接口
// 获取部门列表分页
export function getDeptList(data) {
	return request({
		url: '/sysDept/selectSysDept',
		method: 'get',
		params: data
	});
}

// 获取部门列表分页
export function getDeptListEasy(data) {
	return request({
		url: '/sysDept/selectSysDeptList',
		method: 'get',
		params: data
	});
}

// 添加部门
export function addDept(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDept/insertSysDept',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 获取管理员列表
export function getUserList(data) {
	return request({
		url: '/sysUser/selectSysUser',
		method: 'get',
		params: data
	});
}

// 修改部门信息
export function updateDeptDetail(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDept/updateSysDept',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除部门信息
export function delDept(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDept/deleteSysDept',
		method: 'DELETE',
		data: {
			data: data1
		}
	});
}

// 部门信息条件查询
export function serDept(data) {
	return request({
		url: '/sysDept/selectSysDeptByKey',
		method: 'get',
		params: data
	});
}

// 获取菜单列表信息
export function getMenuInfo(data) {
	return request({
		url: '/sysMenu/selectSysMenu',
		method: 'get',
		params: data
	});
}

// 添加菜单
export function addMenu(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysMenu/addSysMenu',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改菜单信息
export function updateMenuDetail(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysMenu/updateSysMenu',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除菜单信息
export function delMenu(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysMenu/deleteSysMenu',
		method: 'DELETE',
		data: {
			data: data1
		}
	});
}

// 获取角色列表分页
export function getRoleList(data) {
	return request({
		url: '/sysRole/selectSysRoleList',
		method: 'get',
		params: data
	});
}

// 获取角色列表
export function getRoleListEasy(data) {
	return request({
		url: '/sysRole/selectRoleList',
		method: 'get',
		params: data
	});
}

// 获取角色列表加管理员
export function getRoleListAdmin(data) {
	return request({
		url: '/sysRole/selectAllRoleList',
		method: 'get',
		params: data
	});
}

// 添加角色
export function addRole(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysRole/insertSysRole',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改角色信息
export function updateRole(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysRole/updateSysRole',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除角色
export function delRole(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysRole/deleteSysRole',
		method: 'DELETE',
		data: {
			data: data1
		}
	});
}

// 查询角色绑定菜单权限
export function selRoleByMenu(data) {
	// const data1 = rsaEncrypt(data)
	return request({
		url: '/sysRole/selectSysRoleMenu',
		method: 'get',
		params: data
	});
}

// 添加角色菜单权限
export function addRoleMenu(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysRole/insertSysRoleMenu',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 分页查询用户列表
export function getUSerList(data) {
	// const data1 = rsaEncrypt(data)
	return request({
		url: '/sysUser/select',
		method: 'get',
		params: data
	});
}

// 添加用户
export function addUserInfo(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysUser/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改用户
export function updateUserInfo(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysUser/updateSysUser',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除用户
export function deleteUserInfo(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysUser/deleteSysUser',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 获取数据字典列表分页
export function getDicList(data) {
	return request({
		url: '/sysDictType/selectSysDictList',
		method: 'get',
		params: data
	});
}

// 添加父级字典
export function addDicInfoParent(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDictType/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 添加子级字典
export function addDicInfoChild(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDict/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 删除父级字典
export function deleteDicInfoParent(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDictType/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 删除子级字典
export function deleteDicInfoChild(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysDict/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 刷新字典
export function refreshDict(data) {
	return request({
		url: '/sysDict/loaderDictInfo',
		method: 'post',
		data: data
	});
}

// 查询员工部门列表
export function selectSysUserByDept(data) {
	return request({
		url: '/sysUser/selectSysUserByDept',
		method: 'get',
		params: data
	});
}

// 绑定内置角色用户
export function bindRoleUser(data) {
	const data1 = rsaEncrypt(data);
	console.log(data);
	return request({
		url: '/internalRole/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 分页查询内置角色用户列表
export function selectInternalRoleUser(data) {
	return request({
		url: '/internalRole/select',
		method: 'get',
		params: data
	});
}

// 删除内置角色
export function deleteInternalRoleUser(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/internalRole/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 重置用户密码
export function resetUserPassword(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysUser/resetPassword',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 修改密码
export function updatePassword(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/sysUser/updatePassword',
		method: 'put',
		data: {
			data: data1
		}
	});
}
